<template>
  <div>

    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>授权</el-breadcrumb-item>
      <el-breadcrumb-item>用户授权</el-breadcrumb-item>
    </el-breadcrumb>

    <el-form :inline="true" class="query-form" label-width="6rem">
      <el-form-item label="业务系统">
        <el-select v-model="systemsvalue" placeholder="请选择业务系统">
          <el-option v-for="item in systems" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="系统角色">
        <el-select v-model="rolesvalue" placeholder="请选择系统角色">
          <el-option v-for="item in roles" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onBatchAdd">批量添加</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="danger">批量移除</el-button>
      </el-form-item>
    </el-form>

    <el-row style="magrin-top:20px">
      <el-col :span="24">
        <div>
          <el-table class="table" :data="tableData" border stripe>
            <el-table-column type="selection" width="35">
            </el-table-column>
            <el-table-column prop="username" label="姓名">
            </el-table-column>
            <el-table-column prop="account" label="账号">
            </el-table-column>
            <el-table-column prop="status" label="状态">
            </el-table-column>
            <el-table-column label="操作" min-width="30">
              <template slot-scope="scope">
                <el-button size="mini" type="danger">移除</el-button>
              </template>
            </el-table-column>
          </el-table>

          <el-pagination class="pagination" background layout="prev, pager, next" :total="1000">
          </el-pagination>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<style>
.query-form {
  margin-top: 20px;
  padding-top: 25px;
  background-color: #f2f2f2;
}

.table {
  margin-top: 30px;
}

.pagination {
  margin-top: 30px;
  text-align: right;
  padding-right: 2rem;
}

.m-card {
  margin: 30px;
}

.m-tag {
  margin: 10px 0.5rem 0 0;
}

#opform {
  margin-top: 0;
  margin-bottom: 10px;
}

#opform .el-input {
  width: 7.5rem;
}
</style>

<script>
export default {
  name: "RoleAuthorization",
  data() {
    return {
      systems: [
        {
          value: "5b0391fb0677967be4799fbb",
          label: "公共服务投票"
        }
      ],
      systemsvalue: "",
      roles: [
        {
          value: "5b03e00770331f4e64e7ad41",
          label: "系统管理员"
        }
      ],
      rolesvalue: "",
      tags: [
        { name: "公共服务投票-系统管理员", type: "" },
        { name: "公共服务投票-普通用户", type: "" }
      ],
      formInline: {
        username: "",
        account: ""
      },
      tableData: [
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        },
        {
          account: "wang.xiaohu",
          username: "王小虎",
          status: "正常"
        }
      ]
    };
  },
  methods: {
    onBatchAdd() {
      console.log("onBatchAdd!");
      this.$router.push({ name: "BatchAddUserAuthorization", params: {} });
    }
  }
};
</script>
